import request from '#/utils/requestAbort.js';
import type { SaveWinDataType, SaveListingDataType, QueryListingDataType } from './components/type';

// 查询挂牌数据
export async function queryListingData(data: QueryListingDataType) {
  return request('/private-business/listingTransactionDeclaration/getListingData', {
    method: 'POST',
    data,
  });
}

export async function queryWindow({ windowId, marketId }: { windowId: number; marketId: string }) {
  return request(
    `/private-business/listingTransactionDeclaration/queryWindow/${marketId}/${windowId}`,
    {
      method: 'GET',
    },
  );
}

export async function saveListingData(data: SaveListingDataType) {
  return request('/private-business/listingTransactionDeclaration/saveListingData', {
    method: 'POST',
    data,
  });
}

export async function saveWindow(data: SaveWinDataType) {
  return request('/private-business/listingTransactionDeclaration/saveWindow', {
    method: 'POST',
    data,
  });
}

export async function getWindowSelectList({ marketId }: { marketId: string }) {
  return request(
    `/private-business/listingTransactionDeclaration/getWindowSelectList/${marketId}`,
    {
      method: 'GET',
    },
  );
}
